package d;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86183
 * Date: 2024-05-29
 * Time: 19:26
 */
public class Test {
    public static void main(String[] args) {
        MyLinkedList myLinkedList = new MyLinkedList();
        System.out.println("请输入链表A的节点:");
        Scanner scanner = new Scanner(System.in);
        String strA = scanner.nextLine();
        System.out.println("请输入链表B的节点:");
        String strB = scanner.nextLine();
        MyLinkedList.ListNode curA  =  myLinkedList.createList(strA);
        MyLinkedList.ListNode curB  =  myLinkedList.createList(strB);
        System.out.print("链表A和链表B是否相等: ");
        System.out.println(myLinkedList.isEqual(curA, curB));
       MyLinkedList.ListNode node =  myLinkedList.Interest(curA, curB);
       System.out.print("链表A和链表B的交集是: ");
        myLinkedList.print(node);
        MyLinkedList.ListNode node2 = myLinkedList.union(curA,curB);
        System.out.print("链表A和链表B的并集是: ");
       myLinkedList.print(node2);
        MyLinkedList.ListNode node3 = myLinkedList.subtraction(curA,curB);
        System.out.print("链表A和链表B的差集是: ");
        myLinkedList.print(node3);
    }
}

